﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;

namespace GeometryViz3D.Model
{
    public class G3DPlane : G3DElement
    {
        #region Fields

        private List<G3DPoint> m_points = new List<G3DPoint>();

        #endregion

        public G3DPlane()
        {
        }

        #region Properties

        public IList<G3DPoint> Points
        {
            get { return m_points; }
        }

        public Color Color
        {
            get;
            set;
        }

        #endregion

        #region Methods

        void AddPoint(G3DPoint point)
        {
            m_points.Add(point);
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("Plane");

            foreach (var point in m_points)
            {
                sb.AppendFormat(" {0}", point.Label);
            }

            return sb.ToString();
        }

        public override int GetHashCode()
        {
            return this.Label.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            G3DPlane other = obj as G3DPlane;
            if (other == null)
                return false;

            return this.Label == other.Label;
        }

        #endregion
    }
}
